Refactor UI translation files to use nested keys for DRYness#68285
Refactor UI translation files to use nested keys for DRYness#68285pranampagi wants to merge 7 commits into
Conversation
This commit modifies the English translation files to utilize the $t() function for nested text references, significantly reducing translation duplication and making the localization files more DRY. Specific changes include: - Establishing base concepts (Dag, Task, Asset, etc.) in `common.json`. - Implementing internal nesting within `common.json` and `admin.json` (for connection, pool, and variable strings). - Implementing cross-namespace nesting (e.g., using `$t(common:dag_one)`) in `dags.json` to prove that base concepts can be centralized and accessed from separate JSON files. This ensures consistency across the UI and reduces the maintenance surface area for translating future languages.
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
|
Validation performed:
|
There was a problem hiding this comment.
Thanks @pranampagi
1. Some of these change the rendered casing. Where the original text used a lowercase noun mid-sentence, nesting the title-case key capitalizes it:
connections.testDisabled: "Test connection feature…" → "Test Connection feature…"pools.delete.warning: "the pool … this pool" → "the Pool … this Pool"pools.noPoolsFound: "No pools found" → "No Pools found"variables.import.uploadPlaceholder: "containing variables" → "containing Variables"variables.noRowsMessage: "No variables found" → "No Variables found"
Could we leave those running-text strings un-nested? The nesting is great for labels/buttons/titles (those are title-case already), just not for mid-sentence prose where the noun was lowercase on purpose. Or we accept this difference if we think it's fine.
2. Since this is a values-only change, could you add before/after screenshots of the Connections/Pools/Variables screens (or confirm you checked them)? Just to be sure none of the rendered strings shifted unintentionally.
This PR modifies the Airflow UI translation files in the English (
en) locale to utilize the$t()function for nested text references.What and Why:
Previously, core concepts (like "Dag", "Task", "Connection") were repeated verbatim across hundreds of keys. This creates a large maintenance surface area and leaves room for translation inconsistencies across languages.
To make the localization files more DRY (Don't Repeat Yourself), this PR:
common.json.common.jsonandadmin.json(e.g.,"$t(connections.connection_one)").dags.json(e.g.,"$t(common:dag_one)") to prove that base concepts can be centralized and accessed from separate JSON files.Closes: #68252
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.